using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._WorkflowManagerTools._Jobs
{
    /// <summary>
    /// <para>Create Jobs</para>
    /// <para>Creates one or more jobs of the selected job type and assigns the jobs to a user.  The created jobs can be prioritized and have an area of interest (AOI) defined from a feature layer or feature class.</para>
    /// <para>创建所选作业类型的一个或多个作业，并将作业分配给用户。 可以对创建的作业进行优先级排序，并具有从要素图层或要素类定义感兴趣区域 （AOI） 的优先级。</para>
    /// </summary>    
    [DisplayName("Create Jobs")]
    public class CreateJobs : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public CreateJobs()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_Input_DatabasePath">
        /// <para>Input Database Path (.jtc)</para>
        /// <para>The Workflow Manager (Classic) database connection file that contains the job type information. If no connection file is specified, the current default Workflow Manager (Classic) database is used.</para>
        /// <para>包含作业类型信息的 Workflow Manager （Classic） 数据库连接文件。如果未指定连接文件，则使用当前默认的 Workflow Manager （Classic） 数据库。</para>
        /// </param>
        /// <param name="_Job_Types">
        /// <para>Job Type</para>
        /// <para>The job type to be used for creating the new job.</para>
        /// <para>用于创建新作业的作业类型。</para>
        /// </param>
        /// <param name="_Number_of_Jobs">
        /// <para>Number of Jobs To Create</para>
        /// <para>The number of jobs to be created. This input is ignored if AOI Extent has a value or if Merge features to create one AOI is checked.</para>
        /// <para>要创建的作业数。如果 AOI 范围具有值，或者选中了合并要素以创建一个 AOI，则忽略此输入。</para>
        /// </param>
        public CreateJobs(object _Input_DatabasePath, object _Job_Types, long? _Number_of_Jobs)
        {
            this._Input_DatabasePath = _Input_DatabasePath;
            this._Job_Types = _Job_Types;
            this._Number_of_Jobs = _Number_of_Jobs;
        }
        public override string ToolboxName => "Workflow Manager Tools";

        public override string ToolName => "Create Jobs";

        public override string CallName => "wmx.CreateJobs";

        public override List<string> AcceptEnvironments => [];

        public override object[] ParameterInfo => [_Input_DatabasePath, _Job_Types, _Number_of_Jobs, _Users, _Priority_of_Jobs, _Feature_Layer_AOI, _Union_option.GetGPValue(), _Job_ID];

        /// <summary>
        /// <para>Input Database Path (.jtc)</para>
        /// <para>The Workflow Manager (Classic) database connection file that contains the job type information. If no connection file is specified, the current default Workflow Manager (Classic) database is used.</para>
        /// <para>包含作业类型信息的 Workflow Manager （Classic） 数据库连接文件。如果未指定连接文件，则使用当前默认的 Workflow Manager （Classic） 数据库。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Database Path (.jtc)")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Input_DatabasePath { get; set; }


        /// <summary>
        /// <para>Job Type</para>
        /// <para>The job type to be used for creating the new job.</para>
        /// <para>用于创建新作业的作业类型。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Job Type")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _Job_Types { get; set; }


        /// <summary>
        /// <para>Number of Jobs To Create</para>
        /// <para>The number of jobs to be created. This input is ignored if AOI Extent has a value or if Merge features to create one AOI is checked.</para>
        /// <para>要创建的作业数。如果 AOI 范围具有值，或者选中了合并要素以创建一个 AOI，则忽略此输入。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Jobs To Create")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public long? _Number_of_Jobs { get; set; }


        /// <summary>
        /// <para>Assigned User</para>
        /// <para><xdoc>
        ///   <para>The user to whom the new jobs will be assigned. If no value is specified, the default value configured in the job type is used.</para>
        ///   <para>The user or group the new jobs will be assigned to. If no value is specified, the default value configured in the job type is used.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将向其分配新作业的用户。如果未指定任何值，则使用作业类型中配置的默认值。</para>
        ///   <para>将新作业分配到的用户或组。如果未指定任何值，则使用作业类型中配置的默认值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Assigned User")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _Users { get; set; } = null;


        /// <summary>
        /// <para>Job Priority</para>
        /// <para>The priority of the jobs that will be created. If no priority is specified, the default value configured in the job type is used.</para>
        /// <para>将创建的作业的优先级。如果未指定优先级，则使用作业类型中配置的默认值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Job Priority")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _Priority_of_Jobs { get; set; } = null;


        /// <summary>
        /// <para>AOI Extent</para>
        /// <para>The polygon features whose geometry will be used to create the AOI of the new jobs. One job will be created for each feature in the layer unless Merge features to create one AOI is checked.</para>
        /// <para>面要素的几何将用于创建新作业的 AOI。除非选中合并要素以创建一个 AOI，否则将为图层中的每个要素创建一个作业。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("AOI Extent")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _Feature_Layer_AOI { get; set; } = null;


        /// <summary>
        /// <para>Merge features to create one AOI</para>
        /// <para><xdoc>
        ///   <para>Specifies whether one job will be created with the union of all AOI polygons.
        ///   <bulletList>
        ///     <bullet_item>Checked—One union polygon will be generated from the AOI polygons and one job will be created regardless of the input number of jobs.  </bullet_item><para/>
        ///     <bullet_item>Unchecked—Each AOI polygon will be used to generate one job. The total number of jobs created is equal to the total number of polygons in the feature layer. This is the default.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>指定是否使用所有 AOI 面的并集创建一个作业。
        ///   <bulletList>
        ///     <bullet_item>选中—将从 AOI 面生成一个并集面，并且无论输入的作业数如何，都将创建一个作业。</bullet_item><para/>
        ///     <bullet_item>未选中—每个 AOI 面将用于生成一个作业。创建的作业总数等于要素图层中的面总数。这是默认设置。 </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Merge features to create one AOI")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _Union_option_value? _Union_option { get; set; } = null;

        public enum _Union_option_value
        {
            /// <summary>
            /// <para>UNION</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("UNION")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_UNION</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_UNION")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Job ID</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Job ID")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public List<object> _Job_ID { get; set; }


        public CreateJobs SetEnv()
        {
            base.SetEnv();
            return this;
        }

    }

}